<div class="layui-card-body layui-layer-content-beautify">
    <form class="layui-form" style="width: 700px; height: 550px" method="post">
        <div class="layui-form-item">
            <label class="layui-form-label">父级</label>
            <div class="layui-input-block" id="categoryTree">
                {:build_select('row[pid]', $groupData, null, ['class'=>'form-control', 'lay-filter'=>'category', 'aria-invalid'=>'false'])}
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-block">
                <input type="text" name="row[name]" placeholder="名称" value="" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">权限</label>
            <div class="layui-input-block">
                <div id="LAY-auth-tree-index"></div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-block">
                {:build_radios('row[status]', ['1'=>'正常', '2'=>'禁用'])}
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="row[remark]" class="layui-textarea" placeholder=""></textarea>
            </div>
        </div>
    </form>
</div>

<!--<script>-->
<!--    layui.use('authtree', function () {-->
<!--        // 作用域本地化-->
<!--        var authtree = layui.authtree,-->
<!--            backend = layui.plugins,-->
<!--            $ = layui.$;-->
<!--        // 监听父级选择事件-->
<!--        form.on('select(category)', function (obj) {-->
<!--            $.ajax({-->
<!--                url: 'roletree',-->
<!--                dataType: 'json',-->
<!--                type: 'GET',-->
<!--                data: {pid: obj.value},-->
<!--                success: function (ret) {-->
<!--                    if (ret.hasOwnProperty('code')) {-->
<!--                        var data = ret.hasOwnProperty('data') && ret.data !== '' ? ret.data : '';-->
<!--                        if (ret.code === 1) {-->
<!--                            var trees = authtree.listConvert(data, {-->
<!--                                primaryKey: 'id',-->
<!--                                startPid: '#',-->
<!--                                parentKey: 'parent',-->
<!--                                nameKey: 'text',-->
<!--                                valueKey: 'id'-->
<!--                            });-->
<!--                            // 如果页面中多个树共存，需要注意 layfilter 需要不一样-->
<!--                            authtree.render('#LAY-auth-tree-index', trees, {-->
<!--                                inputname: 'rules[]',-->
<!--                                layfilter: 'lay-check-auth',-->
<!--                                autowidth: true-->
<!--                            });-->
<!--                        } else {-->
<!--                            backend.api.toastr.error('权限数据获取失败');-->
<!--                        }-->
<!--                    }-->
<!--                }-->
<!--            });-->
<!--            return false;-->
<!--        });-->
<!--        form.render('select');-->
<!--        // 默认触发select一次事件-->
<!--        $('select[name="row[pid]"]').next().find('.layui-anim').children("dd[class='layui-this']").click();-->
<!--    });-->
<!--</script>-->